package com.imooc.study.func

object Funcs extends App {
  val list = List(1,2,3,4,5)
  private val ints = list.map(_ * 2)
//  ints.foreach(println)

//  ints.filter(p => p >6).foreach(println)

//  ints.reduce()
  val txtList = List("Hello","World","Hello","Hello")
//  txtList.reduce(_ + _)
  val groupBy = txtList.map((_,1)).groupBy(_._1)
  groupBy.map(e =>{
    (e._1,e._2.map(_._2).sum)
  }).toList.foreach(println)

}
